﻿
namespace NetAssist.IO
{
  /// <summary>
  /// Provides a generic file block class that can be used when enumerating the content of a file.
  /// </summary>
  public abstract class FileBlock
  {
    /// <summary>
    /// Initializes a new instance of the NetAssist.IO.FileBlock class.
    /// </summary>
    /// <param name="blockIndex">Indicates the zero based index of the block in the stream/file.</param>
    /// <param name="startPosition">The distance of the start of the block in bytes from the start of the file.</param>
    protected FileBlock(int blockIndex, int startPosition)
    {
      this.BlockIndex = blockIndex;
      this.StartPosition = startPosition;
    }

    /// <summary>
    /// Returns the zero based index of the block in the stream/file.
    /// </summary>
    public int BlockIndex { get; private set; }

    /// <summary>
    /// The distance of the start of the block in bytes from the start of the file.
    /// </summary>
    public int StartPosition { get; private set; }

    /// <summary>
    /// The distance of the end of the block in bytes from the start of the file.
    /// </summary>
    public abstract int EndPosition { get; }

    /// <summary>
    /// The actual length of the block.
    /// </summary>
    public abstract int Length { get; }
  }
}
